 import java.io.*;  


    public class Dir  
    {  
        public void rodar(String cam) throws IOException{   
        	FileWriter writer = new FileWriter(Biblioteca.arquivo + ".txt",true); 
        	File dir = new File(cam);
        	int i;
        	for (i=0;i<dir.list().length;i++){
        		if (Biblioteca.lista.equals("raiz")){
        			if (cam != null && cam.length() > 0) {  
        				if(!cam.substring(cam.length()-1,cam.length()).equals("\\"))
        					cam = cam + "\\";
        			}  
        			writer.write(cam + dir.list()[i] + "\n");
        			System.out.println(cam);
        		}
        		else{
        			if (cam != null && cam.length() > 0) {  
        				if(!cam.substring(cam.length()-1,cam.length()).equals("\\"))
        					cam = cam + "\\";
        			}  
        			writer.write(Biblioteca.lista + "<" + cam + dir.list()[i] + "\n");
        		}
        	}
        	writer.close();
        }
    }  